<!--
* description: 文本输入框通用组件（带单位）
* author: zxuan
* createdDate: 2019-11-21
-->
<template>
  <el-col :span="span" v-show="showow">
    <lableName    :validrule="validrule"    :curLabelName="curLabelName" :isShowLabel="isShowLabel" :isRequire="true"></lableName>
    <el-input
      :style="setInputWidth()"
      :placeholder="readonly ? '' : '请输入'"
      v-model="modelCode"
      :disabled="disabled"
      :readonly="readonly"
      size="small"
      :suffix-icon="readonly ? '' : 'el-icon-search'"
      @clear="clearCode"
      clearable
      resize="none"
      @blur="sendCode1"
      :type="inputType"
    ></el-input>
    <!-- <el-select v-model="unit" v-show="ShowUnit.select" @change="changeUnit" style="width:20%">
      <el-option value="1" label="元">元</el-option>
      <el-option value="2" label="件">件</el-option>
    </el-select> -->
    <!-- <span style="height:29px;line-height:29px" v-show="!ShowUnit.select">{{ShowUnit.text}}</span> -->
    <validateFormate :curLabelName="curLabelName" :validrule="validrule"></validateFormate>
  </el-col>
</template>
<script>
import { inputMixins } from "@/components/mixins/inputMixins";
// import lableName from "@/components/lableName";
// import validateFormate from "@/components/validateFormate";
export default {
  name: "crmTextInput",
  mixins: [inputMixins],
  components: {
    lableName: () => import("@/components/lableName"), //标题溢出样式组件
    validateFormate: () => import("@/components/validateFormate"), //校验提示样式组件
  },
  props:{
    show:{
      type:Boolean,
      default:true
    },
    
  },
  data() {
    return {
      unit:"1",
      showow:this.show,
      
      // placeholder: this.readonly ? "" : "请输入",
      //suffixIcon: this.readonly ? "" : "el-icon-search"
    };
  },

  methods: {
    sendCode1() {
      let val = this.modelCode;
      let text = this.codeField;
      this.$emit("changeCode", val, text);
      this.$emit("changeblur", val);
      this.sendCode();
    },
    setInputWidth(){
    
        return 'width:64%'
      
    }
  }
};
</script>
